<div class="row-content am-cf">
	<div class="row">
		<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
			<div class="widget am-cf">
				<div class="widget-head am-cf">
					<div class="widget-title am-fl">轮播图</div>
					<div class="widget-function am-fr">
						<a href="javascript:;" class="am-icon-cog"></a>
					</div>
				</div>
				<div class="widget-body am-fr">
					<form class="am-form tpl-form-line-form" id="rechargeForm" method="post">
						<input type="hidden" name="id" th:value="${banner.id}" />
						<div class="am-form-group">
							<label for="title" class="am-u-sm-2 am-form-label">标题:</label>
							<div class="am-u-sm-4 am-u-end">
								<input type="text" id="title" class="tpl-form-input" name="title" placeholder="最多15个字"  th:value="${banner.title}" maxlength="15" required="required" /> 
							</div>
						</div>
						
						<div class="am-form-group">
							<label for="orderNum" class="am-u-sm-2 am-form-label">顺序:</label>
							<div class="am-u-sm-2 am-u-end">
								<input type="number" id="orderNum" class="tpl-form-input" name="orderNum" th:value="${banner.orderNum}" placeholder="数字越大，排序越靠前"   required="required" /> 
							</div>
						</div>
					
				       	<div class="am-form-group">
							<label for="descs" class="am-u-sm-2 am-form-label">上传图片
							</label>
							<div class="am-u-sm-10">
								<input id="upFile" type="file"  />
								<input id="imageUrl" name="imageUrl" type="hidden"   th:value="${banner.imageUrl}"/>
								<div>上传图片格式必须为jpg/png。宽*高：1125*645 PX;大小不超过150 KB。</div>
							</div>
						</div>
						
						<div class="am-form-group">
							<label for="realName" class="am-u-sm-2 am-form-label">跳转链接:</label>
							<div class="am-u-sm-4 am-u-end">
								<input type="text" id="jumpUrl" class="tpl-form-input" name="jumpUrl" th:value="${banner.jumpUrl}" required="required" /> 
							</div>
						</div>
						
							
						
						<div class="am-form-group">
							<label for="successTime" class="am-u-sm-2 am-form-label">上下架时间:</label>
							<div class="am-u-sm-2">
								<input type="text" placeholder="上架时间" data-format="yyyy-mm-dd hh:ii:ss" required="required" id="startTime" name="startTime" th:value="${startTime}" class="form-datetime-lang am-form-field"/>
							</div>
							<div class="am-u-sm-2 am-u-end">
								<input type="text" placeholder="下架时间" required="required" id="endTime" name="endTime" th:value="${endTime}" class="form-datetime-lang am-form-field"/>
							</div>
						</div> 
   					
						<div class="am-form-group">
							<div class="am-u-sm-10 am-u-sm-push-2">
								
								<button type="button" onclick="javascript:$('#rechargeForm').submit();"
									class="am-btn am-btn-primary tpl-btn-bg-color-success ">提交</button>
										<button type="button" onclick="loadPage('banner/to_bannner')"
									class="am-btn am-btn-success tpl-btn-bg-color-success ">返回</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>

	</div>
	<script th:inline="javascript">
	<![CDATA[
		
	var canSubmit = true;//表单重复提交控制 
	
	$("#isReceive,#bankId").selected();
	
	$(document).ready(function(){
		
		$('#startTime,#endTime').datetimepicker({
			format: 'yyyy-mm-dd hh:ii:ss',
			autoclose: true,
	        todayBtn: true,
			language:  'zh-CN'
		});
		
		var initImg = "<img src='" + $('#imageUrl').val() + "' class='file-preview-image'>";
		initUpFileOne('upFile','coverImg','选择图片',initImg);
		
		
		
	});
		
	
	function initUpFileOne(id,showId,label,initImg){
		$('#'+id+'').fileinput({
			 showUpload : true,
		     showRemove : false,
		     showCaption: false,
			 showPreview : true, //是否显示预览'
		     language : 'zh',
			 uploadUrl: 'banner/upload',
			 allowedPreviewTypes : [ 'image' ],
		     allowedFileExtensions : [ 'jpg', 'png', 'gif' ],
		     browseClass: "am-btn am-btn-danger am-btn-sm", //按钮样式
		     dropZoneEnabled: false,//是否显示拖拽区域
			 uploadAsync:false,
			 minImageWidth: 1125, //图片的最小宽度
             minImageHeight: 645,//图片的最小高度
             maxImageWidth: 1125,//图片的最大宽度
             maxImageHeight: 645,//图片的最大高度
             maxFileSize: 150,//单位为kb，如果为0表示不限制文件大小
			 uploadClass:'btn btn-default uploadBtnColor',
			 browseIcon:'<i class="am-icon-cloud-upload"></i>',
			 browseLabel:label,
			 removeIcon: '<i class="am-icon-trash"></i>',
			 layoutTemplates:{'footer':''},
			 initialPreview:initImg,
		}).on("filebatchuploadsuccess", function(event, data) {
		    if(data.response.ret==200){
		    	$('#imageUrl').val(data.response.content.info);
		    	layer.msg('上传成功', {
		    		  icon: 1,
		    		  time: 2000 //2秒关闭（如果不配置，默认是3秒）
		    		}); 
		    } else{
		    	layer.msg('服务器错误，请稍后重试~', {
		    		  icon: 3,
		    		  time: 3000 //2秒关闭（如果不配置，默认是3秒）
		    		}); 
		    }
		}); 
	}

	validateUserForm();
	function validateUserForm(){  
		
		 $('#rechargeForm').validate({
		        errorElement : 'span',
		        errorClass : 'am-icon-times',
		        focusInvalid : true,
		        onkeyup:false,
		        ignore : "",
		        rules : {
		        	
		        },
		        messages : {
		        	
		        },
		        submitHandler : function(form) {
		        	if(canSubmit){
		        		commit('rechargeForm', 'banner/saveBanner','banner/to_bannner');
		        	}
		        	
		        }
		    });

	}
		]]>
	</script>